{template 'public/header'}
{template 'public/comhead'}
<style>
     .item_box img{
         width: 100%;
         height: 100%;
     }
</style>
<script type="text/javascript">
    $(function(){
        $(':radio[name="print_status"]').click(function(){
            if(this.checked) {
                if($(this).val() == '1') {
                    $('.sms').show();
                } else {
                    $('.sms').hide();
                }
            }
        });
    });
</script>
{if $operation == 'display'}
<style>
    /*统计样式*/
    .account-stat {
        overflow: hidden;
        color: #666;
    }

    .account-stat .account-stat-btn {
        width: 100%;
        overflow: hidden;
    }

    .account-stat .account-stat-btn > div {
        text-align: center;
        margin-bottom: 5px;
        /*margin-right: 2%;*/
        float: left;
        width: 25%;
        height: 80px;
        padding-top: 10px;
        font-size: 16px;
        border-left: 1px #DDD solid;
    }

    .account-stat .account-stat-btn > div.col-3 {
        width: 31%
    }

    .account-stat .account-stat-btn > div:first-child {
        border-left: 0;
    }

    .account-stat .account-stat-btn > div span {
        display: block;
        font-size: 30px;
        font-weight: bold
    }

    .account-stat .account-stat-btn > div.col-12 {
        width: 12.2%;
    }
</style>
<div class="main">
    <input type="hidden" name="storeid" value="{$storeid}" />
    <div class="clearfix">
        <div class="panel panel-default" id="scroll">
            <div class="panel-heading">
                <h4>数据统计<small class="text-danger">提示:数据只统计在线支付并已完成的订单</small></h4>
            </div>
            <div class="account-stat">
                <div class="account-stat-btn">
                    <div>可申请金额<span>{$totalprice}</span></div>
                    <div>待审核金额<span>{$totalprice2}</span></div>
                    <div>已提现金额<span>{$totalprice1}</span></div>
                    <div>总消费金额<span>{$order_totalprice}</span></div>
                </div>
            </div>
        </div>
    </div>
    <div class="panel panel-default">
        <div class="panel-heading">
            商家提现
        </div>
        <div class="panel-body">
            <form action="" method="post" class="form-horizontal" role="form">
                <input type="hidden" name="storeid" value="{$storeid}" />
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">提现申请</label>
                    <div class="col-sm-9 col-lg-3">
                        <div class="input-group">
                            <input class="form-control" name="price" id="price" type="number" step="0.01" value=""
                                   placeholder="请输入提现金额"  data-limit="0" data-fee-rate="0" data-fee-min="0" data-fee-max="0">
                            <span class="input-group-addon">元</span>
                        </div>
                        <span class="help-block"><code>最低提现金额为{$getcash_price}元</code></span>
                    </div>
                    <input type="submit" name="submit" value="提交" class="btn btn-success col-lg-1" onclick="return confirm('此操作不可恢复，确认提交吗？');return false;">
                    <input type="hidden" name="token" value="{$_W['token']}" />
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">手续费</label>
                    <div class="col-sm-9 form-control-static">
                        （每笔交易{$fee_rate}%，最低{$fee_min}元，最高{$fee_max}元）
                    </div>
                </div>

            </form>
        </div>
    </div>
    <form action="" method="post" class="form-horizontal form">
        <div class="panel panel-default">
            <div class="table-responsive panel-body">
                <table class="table table-hover">
                    <thead class="navbar-inner">
                    <tr>
                        <th style="width:10%;">编号</th>
                        <th style="width:15%;">申请提现金额</th>
                        <th style="width:15%;">手续费</th>
                        <th style="width:15%;">到帐金额</th>
                        <th style="width:15%;">处理时间</th>
                        <th style="width:15%;">申请时间</th>
                        <th style="width:15%;">状态</th>
                    </tr>
                    </thead>
                    <tbody>
                    {loop $list $item}
                    <tr>
                        <td>{$item['id']}</td>
                        <td>{$item['price']}</td>
                        <td>{$item['charges']}</td>
                        <td>{$item['successprice']}</td>
                        <td>
                            {if empty($item['handletime'])}
                            ------
                            {else}
                            {php echo date("Y-m-d H:i:s", $item['handletime'])}
                            {/if}
                        </td>
                        <td>
                            {php echo date("Y-m-d H:i:s", $item['dateline'])}
                        </td>
                        <td>
                            {if $item['status'] == 1}
                            <span class="label label-success">已提现</span>
                            {else}
                            <span class="label label-danger">待审核</span>
                            {/if}
                            <!--0为打印成功, 1为过热,3为缺纸卡纸等-->
                        </td>
                    </tr>
                    {/loop}
                    </tbody>
                </table>
                {$pager}
            </div>
        </div>
    </form>
</div>
{elseif $operation == 'post'}
<div class="main">
	<form action="" method="post" class="form-horizontal form" enctype="multipart/form-data">
	<input type="hidden" name="id" value="{$setting['id']}" />
        <div class="panel panel-default">
            <div class="panel-heading">
                打印机设置
            </div>
            <div class="panel-body">
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">打印机名称</label>
                    <div class="col-sm-9">
                        <input type="text" name="title" class="form-control" value="{$setting['title']}" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">类型</label>
                    <div class="col-sm-9">
                        <select class="form-control" name="type" id="type" autocomplete="off">
                            <option value="365" {if $setting['type']=='365'}selected{/if}>365打印机</option>
                            <option value="feiyin" {if $setting['type']=='feiyin'}selected{/if}>飞印打印机</option>
                            <option value="feie" {if $setting['type']=='feie'}selected{/if}>飞鹅打印机</option>
                            <option value="hongxin" {if $setting['type']=='hongxin'}selected{/if}>宏信物联打印机</option>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">打印机设备编码</label>
                    <div class="col-sm-9">
                        <input type="text" name="print_usr" class="form-control" value="{$setting['print_usr']}" placeholder="SN码|机器码|IMEI码"/>
                    </div>
                </div>
                <div class="form-group" id="print_code">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">打印机商户编码</label>
                    <div class="col-sm-9">
                        <input type="text" name="member_code" class="form-control" value="{$setting['member_code']}" placeholder="商户编码"/>
                    </div>
                </div>
                <div class="form-group" id="print_key">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">打印机API密钥</label>
                    <div class="col-sm-9">
                        <input type="text" name="feyin_key" class="form-control" value="{$setting['feyin_key']}" placeholder="API密钥"/>
                    </div>
                </div>
                <div class="form-group" id="print_goodstype">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">设置可打印的分类</label>
                    <div class="col-sm-9">
                        <select class="form-control" style="margin-right:15px;" name="print_goodstype[]" autocomplete="off" multiple="true" size="10">
                            <option value="0" {if count($print_goodstypes)==0}selected="selected"{/if}>全部分类</option>
                            {loop $category $row}
<option value="{$row['id']}" {if count($print_goodstypes)>0 && in_array($row['id'],$print_goodstypes)}
                            selected="selected"{/if}>{$row['name']}</option>
                            {/loop}
                        </select>
                        <span class="help-block">当您设置了分类后，该打印机就只关心来自分类的订单。</span>
                    </div>
                </div>
                <div class="form-group" id="is_print_all">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">是否为全品打印</label>
                    <div class="col-sm-9">
                        <label for="is_print_all2" class="radio-inline"><input type="radio" name="is_print_all" value="1" id="is_print_all2" {if $setting['is_print_all']==1 || empty($setting)}checked{/if} /> 是</label>
                        <label for="is_print_all1" class="radio-inline"><input type="radio" name="is_print_all" value="0" id="is_print_all1"  {if $setting['is_print_all']==0}checked{/if} /> 否</label>
                        <span class="help-block">全品打印机为： 打印订单的全部产品条目信息</span>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">打印机状态</label>
                    <div class="col-sm-9">
                        <label for="print_status" class="radio-inline"><input type="radio" name="print_status" value="1" id="print_status" {if $setting['print_status']==1}checked{/if} /> 启用</label>
                        &nbsp;&nbsp;&nbsp;
                        <label for="print_status2" class="radio-inline"><input type="radio" name="print_status" value="0" id="print_status2"  {if $setting['print_status']==0 || empty($setting)}checked{/if} /> 关闭</label>
                        <span class="help-block"></span>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">打印方式</label>
                    <div class="col-sm-9">
                        <label for="print_type1" class="radio-inline"><input type="radio" name="print_type" value="0" id="print_type1" {if $setting['print_type']==0}checked="true"{/if}/>下单打印</label>
                        &nbsp;&nbsp;&nbsp;
                        <label for="print_type2" class="radio-inline"><input type="radio" name="print_type" value="1" id="print_type2"  {if $setting['print_type']==1}checked="true"{/if}/>打印付款订单</label>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">打印联数</label>
                    <div class="col-sm-9">
                        <input type="text" name="print_nums" class="form-control"
                               value="{if $setting['print_nums']}{$setting['print_nums']}{else}1{/if}" />
                        <p class="help-block">默认1</p>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">打印二维码</label>
                    <div class="col-sm-9">
                        <label for="qrcode_status1" class="radio-inline"><input type="radio" name="qrcode_status" value="0" id="qrcode_status1" {if $setting['qrcode_status']==0}checked="true"{/if}/>关闭</label>
                        &nbsp;&nbsp;&nbsp;
                        <label for="qrcode_status2" class="radio-inline"><input type="radio" name="qrcode_status" value="1" id="qrcode_status2"  {if $setting['qrcode_status']==1}checked="true"{/if}/>开启</label>
                        <p class="help-block">(<font color="red">目前只支持宏信物联</font>)仅支持二维码打印驱动板的 打印机型号 HX-159</p>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">二维码网址</label>
                    <div class="col-sm-9">
                        <input type="text" name="qrcode_url" class="form-control" value="{$setting['qrcode_url']}" />
                        <p class="help-block">网址过长的可先转为短网址</p>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">头部自定义信息</label>
                    <div class="col-sm-9">
                        <input type="text" name="print_top" class="form-control" value="{$setting['print_top']}" />
                        <p class="help-block">建议少于20字</p>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">底部自定义信息</label>
                    <div class="col-sm-9">
                        <input type="text" name="print_bottom" class="form-control" value="{$setting['print_bottom']}" />
                        <p class="help-block">建议少于20字</p>
                    </div>
                </div>
            </div>
        </div>
        <div class="form-group col-sm-12">
            <input type="submit" name="submit" value="保存设置" class="btn btn-primary col-lg-1" />
            <input type="hidden" name="token" value="{$_W['token']}" />
        </div>
	</form>
</div>
<script type="text/javascript">
    $(function(){
        "{if $setting}"
        "{if $setting['type']=='hongxin'}"
        $('#print_code').hide();
        $('#print_key').hide();
        $('#print_goodstype').hide();
        $('#is_print_all').hide();
        "{/if}"
        "{if $setting['type']=='365' || $setting['type']=='feie'}"
        $('#print_code').hide();
        "{/if}"
        "{else}"
        $('#print_code').hide();
        "{/if}"
        $('#type').change(function(){
            $('#print_code').show();
            $('#print_key').show();
            if($(this).val() == 'hongxin') {
                $('#print_code').hide();
                $('#print_key').hide();
                $('#print_goodstype').hide();
                $('#is_print_all').hide();
            }
            if($(this).val() == '365' || $(this).val() == 'feie') {
                $('#print_code').hide();
            }
        });
    });
</script>


{/if}
{template 'common/footer'}